const WXAPI = require('apifm-wxapi')
Page({
  data: {
    sj: {}
  },
  onLoad: function (options) {
    // options.key = 'aboutus'
    this.setData({
      sj: options
    })
    // 设置标题

    setTimeout(() => {
      wx.setNavigationBarTitle({
        title: this.data.sj.fxname || '',
      })
    }, 1000)


    // this.cmsPage()
  },
  onShow: function () {

  },

  onShareAppMessage(options) {
    console.log(options)
    console.log("ffff", this.data.id)
    // 自定义标题和封面图
    return {
      title: this.data.sj.fxname || '',
      path: '/pages/webview/index?url=' + (options.webViewUrl?options.webViewUrl:this.data.sj.url) + '&fxname=' + this.data.sj.fxname + '&fximg=' + this.data.sj.fximg,
      imageUrl: this.data.sj.fximg || 'https://www.mlito.com/wp-content/uploads/fx_zdy5_4.png',
    }
  },


  onShareTimeline(options) {
    console.log("ffff222", this.data.id)
    console.log(options)
    return {
      title: this.data.sj.fxname || '',
      query: 'url=' + (options.webViewUrl?options.webViewUrl:this.data.sj.url) + '&fxname=' + this.data.sj.fxname + '&fximg=' + this.data.sj.fximg,
      imageUrl: this.data.sj.fximg || 'https://www.mlito.com/wp-content/uploads/fx_zdy5_4.png',
    }
  },


  async cmsPage() {
    // const res = await WXAPI.cmsPage(this.data.key)
    // if (res.code == 0) {
    //   this.setData({
    //     cmsPageDetail: res.data
    //   })
    //   wx.setNavigationBarTitle({
    //     title: res.data.info.title,
    //   })
    // }
  },
})